package com.zy.edu.controller;


import com.zy.edu.bean.Region;
import com.zy.edu.service.RegionService;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author HuangHaiShui
 * @since 2021-07-14
 */
@RestController
@RequestMapping("/region")
public class RegionController {

    @Resource
    RegionService regionService;

    /**
     * @Author: HuangHaiShui
     * @Description: 省份信息的获取
     * @Date: 9:16 2021/7/14
     * @param :
     * @return: Map
     **/
    @RequestMapping("getProvince")
    public Map getProvince(   ){
        
        return regionService.getProvince();
    }



    /**
     * @Author: HuangHaiShui
     * @Description: 下级区域的获取
     * @Date: 9:15 2021/7/14
     * @param region: 传pid字段即可
     * @return: Map
     **/
    @RequestMapping("getCity")
    public Map getCity(@Valid Region region){

        return regionService.getCity(region);
    }

}

